<div class="box-tools" style="top:10px;">
  <form class="form-inline" id="project—form" action="{:url('Money/memberList')}" method="GET" pjax-search="">
    <div class="form-group">
      <label for="name">姓名</label>
      <input type="text" name="name" id="name" class="form-control" value="{:input('get.search')}"
             placeholder="按姓名搜索"/>
    </div>
    <div class="form-group">
      <label for="phone" class="hry-require">手机号码</label>
      <input type="text" name="phone" id="phone" class="form-control" value="{:input('get.search')}"
             placeholder="按手机号码"/>
    </div>
    <div class="form-group">
      <button type="submit" class="btn btn-primary sreachs" onClick="return toVailds()">搜索</button>
      <button type="button" id="dwonload" class="btn btn-primary sreachs">下载</button>
      <button type="button" class="btn btn-primary" onclick="resetForm()">重置</button>
    </div>
  </form>
</div>
<script>
    $(function () {
        $('#dwonload').click(function () {
            var url = "{:url('Money/memberList')}";
            var name = $("select[name='name']").val();
            var phone = $("input[name='phone']").val();
            location.href = url + "?name=" + name + "phone=" + phone + "&down=1";
        })
    })

    function toVailds() {
        let id = $('#phone').val()
        var idreg = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
        let validate = false
        if (id === '') {
            $.amaran({'message': '请输入手机号!'});
            validate = false
        } else if (!idreg.test(id)) {
            $.amaran({'message': '请输入正确的手机!'});
            validate = false
        } else {
            validate = true
        }
        return validate
    }

    function resetForm() {
        $('input[name="phone"]').val('')
        $('input[name="name"]').val('')
        $('#project—form').submit()
    }
</script>